package array
//切片实现队列rpop功能
func ArrayRPop(arr []string)([]string,string){
	var newArr []string
	length:=len(arr)
	end:=length-1
	if end<0{
		return newArr,""
	}
	if end==0{
		return newArr,arr[end]
	}
	newArr=arr[0:end]
	return newArr,arr[end]
}
//切片实现队列lpush功能
func ArrayLPush(arr []string,item string)([]string){
	//创建个新的slice
	var newArr =[]string{item}
	//往新的slice里追加旧的slice
	newArr=append(newArr,arr...)
	return newArr
}
//切片实现队列lpop功能
func ArrayLPop(arr []string)([]string){
	arr=arr[1:]
	return arr
}
func ArrayBegin(arr []string)string{
	return arr[0]
}
func ArrayEnd(arr []string)string{
	length:=len(arr)
	if length<1{
		return ""
	}
	return arr[length-1]
}
//切片实现队列rpush功能
func ArrayRPush(arr []string,item string)([]string){
	arr=append(arr,item)
	return arr
}